<?php

namespace Database\Seeders;

use Dcat\Admin\Models\Menu;
use Illuminate\Database\Seeder;

class CommonSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $menus = [
            ['id'=> '8','title'=> '常规管理','icon'=> 'fa-building','uri'=> '','parent_id'=> 0],
            ['id'=> '9','title'=> '系统配置','icon'=> 'fa-server','uri'=> 'general/config','parent_id'=> 8],
            ['id'=> '10','title'=> '用户管理','icon'=> 'fa-user','uri'=> 'user','parent_id'=> 0],
        ];

        foreach ($menus as $key=>$value){
            $find = Menu::query()->where("id",$value['id'])->first();
            if (!$find){
                Menu::query()->create($value);
            }
        }

        $list = [
            ['id'=>3,'icon'=>'fa-users'],
            ['id'=>4,'icon'=>'fa-address-card'],
            ['id'=>5,'icon'=>'fa-anchor'],
            ['id'=>6,'icon'=>'fa-align-justify'],
            ['id'=>7,'icon'=>'fa-sitemap'],
        ];
        foreach ($list as $value){
           Menu::query()->where("id",$value['id'])->update(['icon'=>$value['icon']]);
        }

    }
}
